package service.impl;

import entity.Evaluation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import repository.EvaluationRepository;
import service.EvaluationService;

import java.util.List;

@Service
public class EvaluationServiceImpl implements EvaluationService {
    @Autowired
    private EvaluationRepository evaluationRepository;

    public Integer save(Object o) {
        Evaluation evaluation = (Evaluation) o;
        return evaluationRepository.save(evaluation);
    }

    public List findAll() {
        return evaluationRepository.findAll();
    }

    public void delete(Integer id) {
        evaluationRepository.delete(id);
    }

    public Integer update(Object o) {
        Evaluation evaluation = (Evaluation) o;
        evaluationRepository.saveOrUpdate(evaluation);
        return evaluation.getId();
    }
}
